home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Frameworks / MacZoop 1.6.5 / Basic Classes / Z Headers / ZCommander.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-14  |  1.9 KB  |  84 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZCommander.h            -- an object for handling commands
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21. #pragma once
  22.  
  23. #ifndef __ZCOMMANDER__
  24. #define __ZCOMMANDER__
  25.  
  26. #ifndef __ZCOMRADE__
  27. #include    "ZComrade.h"
  28. #endif
  29.  
  30. #ifndef __ZOBJECTARRAY__
  31. #include    "ZObjectArray.h"
  32. #endif
  33.  
  34. #include    <AppleEvents.h>
  35.  
  36. class    ZCommander;
  37.  
  38.  
  39. typedef ZObjectArray<ZCommander>    ZCommanderList;    
  40.  
  41.  
  42. class    ZCommander : public ZComrade
  43. {
  44. protected:
  45.     ZCommander*        itsBoss;
  46.     ZCommanderList*    itsUnderlings;
  47.     
  48. public:
  49.     ZCommander( ZCommander* aBoss );
  50.     virtual ~ZCommander();
  51.  
  52.     virtual void    HandleCommand( const short menuID, const short itemID);
  53.     virtual void    HandleCommand( const long theCommand );
  54.     virtual void    UpdateMenus();
  55.     virtual void    HandleAppleEvent(    AEEventClass aeClass, AEEventID aeID,
  56.                                         AppleEvent* aeEvt, AppleEvent* reply );
  57.  
  58.     virtual void    Idle();
  59.     virtual void    Type( const char theKey );
  60.     virtual void    SendMessage( long aMessage, void* msgData );
  61.     virtual void    SendMessage( ZMessage* aMessage );
  62.     
  63.     virtual void    DoCut() {};
  64.     virtual void    DoCopy() {};
  65.     virtual void    DoPaste() {};
  66.     virtual void    DoClear() {};
  67.     virtual void    DoSelectAll() {};
  68.     virtual Boolean CanPasteType() { return FALSE; };
  69.  
  70.     inline    ZCommander*    GetBoss(){ return itsBoss; };
  71.     inline    ZCommanderList*    GetUnderlings() { return itsUnderlings; };
  72.     
  73. protected:
  74.  
  75.     virtual void    AddUnderling( ZCommander* anUnderling );
  76.     virtual void    RemoveUnderling( ZCommander* anUnderling );
  77. };
  78.  
  79.  
  80. // windows and the application are derived from this. It implements a single entity in the
  81. // "chain of command". You can subclass this to make any object that can handle commands,
  82. // though more usually you will subclass windows.
  83.  
  84. #endif